package com.hxd.otc.module.my.presenter;

import android.support.annotation.NonNull;

import com.hxd.otc.base.BaseBean;
import com.hxd.otc.module.my.bean.RealNameAuthRuleInfoBean;
import com.hxd.otc.module.my.contract.CertificationDetailContract;
import com.hxd.otc.module.my.model.UserModel;
import com.hxd.otc.mvp.base.BasePresenter;
import com.hxd.otc.net.BaseObserver;

import java.util.ArrayList;

/**
 * Created by lzy on 2018/12/5 0005.
 * description ${认证详情Presenter}
 */
public class CertificationDetailPresenter extends BasePresenter<CertificationDetailContract.IView> implements CertificationDetailContract.IPresenter {

    private final UserModel mUserModel;

    public CertificationDetailPresenter(CertificationDetailContract.IView iView) {
        super(iView);
        mUserModel = UserModel.getInstance();
    }


    @Override
    public void getRealNameAuthRuleInfo() {
        mUserModel.getRealNameAuthRuleInfo(new BaseObserver<ArrayList<RealNameAuthRuleInfoBean>>() {
            @Override
            public void onNext(@NonNull String msg, @NonNull ArrayList<RealNameAuthRuleInfoBean> realNameAuthRuleInfoBeans) {
                mView.getRealNameAuthRuleInfoSuccess(realNameAuthRuleInfoBeans);
            }

            @Override
            public void onError(int errType, @NonNull String errMessage) {
                mView.getRealNameAuthRuleInfoFail(errMessage);
            }
        }, mView.<BaseBean<ArrayList<RealNameAuthRuleInfoBean>>>bindAutoDispose());
    }
}
